package com.sample.entity;

import java.time.LocalTime;

import com.sample.typehandler.Time2IntTypeHandler;
import com.swak.App;
import com.swak.annotation.Column;
import com.swak.annotation.Table;
import com.swak.annotation.table.Scene;
import com.swak.persistence.BaseMapper;
import com.swak.persistence.Model;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * Test.
 * 
 * @author Auto Generator
 * @date 2023-05-31T10:12:33.014368700
 */
@Getter
@Setter
@Accessors(chain = true)
@Table(value = "SAMPLE_TEST", scene = Scene.Full, useOptimismLock = true)
public class Test extends Model<Test, Long> {

	@lombok.EqualsAndHashCode.Exclude
	@lombok.ToString.Exclude
	private static volatile transient BaseMapper<Test, Long> _mapper;

	public static final String Id = "ID";
	public static final String Name = "NAME";
	public static final String Quantity = "QUANTITY";
	public static final String UniqueKey1 = "UNIQUE_KEY1";
	public static final String UniqueKey2 = "UNIQUE_KEY2";
	public static final String Version = "VERSION";
	public static final String CreateDate = "CREATE_DATE";
	public static final String UpdateDate = "UPDATE_DATE";
	public static final String DelFlag = "DEL_FLAG";
	public static final String DelAt = "DEL_AT";

	private String name; // 名称
	private Integer quantity; // 数量
	private String uniqueKey1; // 组合唯一键
	private String uniqueKey2; // 组合唯一键
	private LocalTime beginTime;//开始时间
	@Column(handler = Time2IntTypeHandler.class)
	private LocalTime beginTime2;//开始时间

	@Override
	@SuppressWarnings("unchecked")
	protected BaseMapper<Test, Long> getSqlRunner() {
		if (_mapper == null) {
			synchronized (Test.class) {
				if (_mapper == null) {
					_mapper = (BaseMapper<Test, Long>) App.getBean(getTableDefine().getMapper());
				}
			}
		}
		return _mapper;
	}

	public static Test of() {
		return new Test();
	}
}
